<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <button>发起请求</button>
    <div style="font-size: 200px; font-weight: 700"></div>
    <script src="./Promise.js"></script>
    <script>
      document.querySelector('button').addEventListener('click', function () {
        Promise.all([
          zslAjax({
            method: 'GET',
            url: 'http://ajax-base-api-t.itheima.net/api/getbooks',
          }),
          zslAjax({
            method: 'GET',
            url: 'http://ajax-base-api-t.itheima.net/api/getbooks',
          }),
          zslAjax({
            method: 'GET',
            url: 'http://ajax-base-api-t.itheima.net/api/getbooks',
          }),
        ])
          .then((res) => {
            console.log(res)
            document.querySelector('div').innerHTML = '请求成功'
          })
          .catch((err) => {
            console.log(err)
            document.querySelector('div').innerHTML = '404'
          })
      })
    </script>
  </body>
</html>
